package com.bristua.mall.admin.user.controller;

import com.bristua.mall.admin.common.bean.Result;
import com.bristua.mall.admin.common.enums.CommonCode;
import com.bristua.mall.admin.common.utils.HandleResultUtil;
import com.bristua.mall.admin.user.biz.SystemUserLoginBiz;
import com.bristua.mall.admin.user.model.condition.UserLoginParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2019/4/2.
 */
@RestController
public class SystemUserLoginController {

    @Autowired
    private SystemUserLoginBiz systemUserLoginBiz;

    @PostMapping(value="/admin/system/login")
    public Result systemUserLogin(@RequestBody UserLoginParams userLoginParams){
        Result result = new Result();
        Map<String,Object> map = new HashMap();
        map.put("token",systemUserLoginBiz.userLogin(userLoginParams));
        result.setData(map);
        result.setMsg(CommonCode.LOGIN_SUCCESS.getMsg());
        result.setCode(CommonCode.LOGIN_SUCCESS.getCode());
        return result;
    }
}
